package main

import "fmt"

func main() {
	// get name, age and is happy from terminal
	var name string
	var age int
	var happy bool
	name, age, happy = getByScanln()
	fmt.Printf("name = %v, age = %v, happy = %v\n", name, age, happy)
	name, age, happy = getByScanf()
	fmt.Printf("name = %v, age = %v, happy = %v\n", name, age, happy)
}

func getByScanln() (string, int, bool) {
	var name string
	var age int
	var happy bool
	fmt.Println("please enter name: ")
	fmt.Scanln(&name)
	fmt.Println("please enter age: ")
	fmt.Scanln(&age)
	fmt.Println("please enter happy: ")
	fmt.Scanln(&happy)
	return name, age, happy
}

func getByScanf() (string, int, bool) {
	var name string
	var age int
	var happy bool
	//fmt.Println("please enter name: ")
	//fmt.Scanf("%s\n", &name)
	//fmt.Println("please enter age: ")
	//fmt.Scanf("%d\n", &age)
	//fmt.Println("please enter happy: ")
	//fmt.Scanf("%t\n", &happy)
	fmt.Println("please enter name, age, happy, split by comma ")
	fmt.Scanf("%s %d %t", &name, &age, &happy)
	return name, age, happy
}
